package controller

import (
	"sems/model"
	"time"
	"unicode"
)

func IsNumeric(s string) bool {
	for _, ch := range s {
		if !unicode.IsDigit(ch) {
			return false
		}
	}
	return true
}

func TimeParse(timeStr string) (time.Time, error) {
	return time.ParseInLocation("2006-01-02 15:04:05", timeStr, time.Local)
}

// 计算预定时间范围内的总预定数量
func calculateTotalBooked(bookings []model.ReservationRequest) int32 {
	var total int32
	for _, booking := range bookings {
		total += booking.RequestCount
	}
	return total
}
